﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using DLM.Domain.Model;
using DLM.Services.Interfaces;
using DLM.Web.MVC.Extensions;
using DLM.Web.ViewModel;
using System.Collections.Specialized;
using Webdiyer.WebControls.Mvc;

namespace DLM.Web.MVC.Areas.Management.Controllers
{
    [AdminAuthorize]
    public class OrderController : Controller
    {
        private IPaymentService paymentService;
        public OrderController(IPaymentService paymentService)
        {
            this.paymentService = paymentService;
        }

        public ActionResult List(int? page)
        {
            var list = this.paymentService.Orders(page ?? 0, 18);
            return View(list);
        }

        [HttpPost]
        public ActionResult SendGoods(string orderNo, string tradeNo,int userID,decimal price)
        {
            Order order = new Order
            {
                OrderNo = orderNo,
                TradeNo = tradeNo,
                UserID = userID,
                Price = price
            };
            var response = this.paymentService.ConfirmForOrder(order);
            // Response.Write(response);
            return RedirectToAction("List");
        }

    }
}
